<?php
/**
 * System_Model_DbTable_Role
 *
 * @author maomao.thx@gmail.com
 * @copyright Copyright (c) 2009 Green Shore (http://www.iwgame.com)
 * @version $Id: Role.php 906 2011-10-20 02:38:33Z mmxie $
 */
class System_Model_DbTable_Role extends IG_Model_DbTable
{

    protected $_name = 'sys_role';

    public $_primary = 'role_id';

    protected $_dependentTables = array(
        'System_Model_DbTable_EmployeeRole',
        'System_Model_DbTable_RoleResource'
    );

    public function getResources($model)
    {
        return $this->createRow($model->toArray())
                    ->findManyToManyRowset('System_Model_DbTable_Resource',
                                           'System_Model_DbTable_RoleResource',
                                           null,
                                           null,
                                           $this->select()
                                                ->where('action is not null'));
    }

    public function getResourcesId()
    {
        ;
    }
}

